#-*- coding: utf8 -*-
from tutor.scripts import *
from tutor.plugins.maple import *

a = M.a

# parâmetros iniciais
r = oneof(1, 2, 3, 4, 5) * oneof(-1, 1)
s = oneof(1, 2, 3, 4, 5) * oneof(-1, 1)

# força
F = (s * x + r * y) * ii + (s * y - r * x) * jj
Fx = M.coeff(F, ii)
Fy = M.coeff(F, jj)
print('F: %s' % F)

# parametrizaçao do caminho
X = a * M.cos(t)
Y = a * M.sin(t)
Vx, Vy = (M.diff(f, t) for f in [X, Y])
FFx = M.subs(x == X, y == Y, Fx)
FFy = M.subs(x == X, y == Y, Fy)
v = a

# Work
work = 2 * M.Pi * M.simplify(M.expand(Vx * FFx + Vy * FFy))
wCCW = -work
print('work: %s' % work)

# wMod
wMod = 2 * M.Pi * M.simplify(M.expand(FFx ** 2 + FFy ** 2))
wMCCW = -wMod
print('wMod: %s' % wMod)
